home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / cpio-2_3.lha / cpio-2.3 / configure < prev    next >
Text File  |  1993-07-05  |  26KB  |  1,139 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  74.        verbose=yes ;;
  75.  
  76.      *) ;;
  77.     esac
  78.   fi
  79. done
  80.  
  81. trap 'rm -f conftest* core; exit 1' 1 3 15
  82.  
  83. # NLS nuisances.
  84. LANG=C; LC_ALL=C; export LANG; export LC_ALL;
  85.  
  86. rm -f conftest*
  87. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  88.  
  89. # A filename unique to this package, relative to the directory that
  90. # configure is in, which we can look for to find out if srcdir is correct.
  91. unique_file=cpio.h
  92.  
  93. # Find the source files, if location was not specified.
  94. if test -z "$srcdir"; then
  95.   srcdirdefaulted=yes
  96.   # Try the directory containing this script, then `..'.
  97.   prog=$0
  98.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  99.   test "X$confdir" = "X$prog" && confdir=.
  100.   srcdir=$confdir
  101.   if test ! -r $srcdir/$unique_file; then
  102.     srcdir=..
  103.   fi
  104. fi
  105. if test ! -r $srcdir/$unique_file; then
  106.   if test x$srcdirdefaulted = xyes; then
  107.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  108.   else
  109.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  110.   fi
  111.   exit 1
  112. fi
  113. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  114. # But we can't avoid them for `..', to make subdirectories work.
  115. case $srcdir in
  116.   .|/*|~*) ;;
  117.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  118. esac
  119.  
  120. # Save the original args to write them into config.status later.
  121. configure_args="$*"
  122.  
  123. PROGS="cpio"
  124. if test -z "$CC"; then
  125.   # Extract the first word of `gcc', so it can be a program name with args.
  126.   set dummy gcc; word=$2
  127.   echo checking for $word
  128.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  129.   for dir in $PATH; do
  130.     test -z "$dir" && dir=.
  131.     if test -f $dir/$word; then
  132.       CC="gcc"
  133.       break
  134.     fi
  135.   done
  136.   IFS="$saveifs"
  137. fi
  138. test -z "$CC" && CC="cc"
  139. test -n "$CC" -a -n "$verbose" && echo "    setting CC to $CC"
  140.  
  141. # Find out if we are using GNU C, under whatever name.
  142. cat > conftest.c <<EOF
  143. #ifdef __GNUC__
  144.   yes
  145. #endif
  146. EOF
  147. ${CC-cc} -E conftest.c > conftest.out 2>&1
  148. if egrep yes conftest.out >/dev/null 2>&1; then
  149.   GCC=1 # For later tests.
  150. fi
  151. rm -f conftest*
  152.  
  153. echo checking how to run the C preprocessor
  154. if test -z "$CPP"; then
  155.   CPP='${CC-cc} -E'
  156.   cat > conftest.c <<EOF
  157. #include <stdio.h>
  158. Syntax Error
  159. EOF
  160. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  161. if test -z "$err"; then
  162.   :
  163. else
  164.   CPP=/lib/cpp
  165. fi
  166. rm -f conftest*
  167. fi
  168.  
  169. if test -n "$GCC"; then
  170.   echo checking whether -traditional is needed
  171.   pattern="Autoconf.*'x'"
  172.   prog='#include <sgtty.h>
  173. Autoconf TIOCGETP'
  174.   cat > conftest.c <<EOF
  175. $prog
  176. EOF
  177. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  178. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  179.   need_trad=1
  180. fi
  181. rm -f conftest*
  182.  
  183.  
  184.   if test -z "$need_trad"; then
  185.     prog='#include <termio.h>
  186. Autoconf TCGETA'
  187.     cat > conftest.c <<EOF
  188. $prog
  189. EOF
  190. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  191. if egrep "$pattern" conftest.out >/dev/null 2>&1; then
  192.   need_trad=1
  193. fi
  194. rm -f conftest*
  195.  
  196.   fi
  197.   test -n "$need_trad" && CC="$CC -traditional"
  198. fi
  199.  
  200. # Make sure to not get the incompatible SysV /etc/install and
  201. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  202. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  203. # or the AFS install, which mishandles nonexistent args, or
  204. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  205. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  206. # anyway.  Sigh.
  207. if test "z${INSTALL}" = "z" ; then
  208.   echo checking for install
  209.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  210.   for dir in $PATH; do
  211.     test -z "$dir" && dir=.
  212.     case $dir in
  213.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  214.     *)
  215.       if test -f $dir/installbsd; then
  216.     INSTALL="$dir/installbsd -c" # OSF1
  217.     INSTALL_PROGRAM='$(INSTALL)'
  218.     INSTALL_DATA='$(INSTALL) -m 644'
  219.     break
  220.       fi
  221.       if test -f $dir/install; then
  222.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  223.       : # AIX
  224.     else
  225.       INSTALL="$dir/install -c"
  226.       INSTALL_PROGRAM='$(INSTALL)'
  227.       INSTALL_DATA='$(INSTALL) -m 644'
  228.       break
  229.     fi
  230.       fi
  231.       ;;
  232.     esac
  233.   done
  234.   IFS="$saveifs"
  235. fi
  236. INSTALL=${INSTALL-cp}
  237. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  238. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  239.  
  240. echo checking for AIX
  241. cat > conftest.c <<EOF
  242. #ifdef _AIX
  243.   yes
  244. #endif
  245.  
  246. EOF
  247. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  248. if egrep "yes" conftest.out >/dev/null 2>&1; then
  249.   {
  250. test -n "$verbose" && \
  251. echo '    defining' _ALL_SOURCE
  252. DEFS="$DEFS -D_ALL_SOURCE=1"
  253. }
  254.  
  255. fi
  256. rm -f conftest*
  257.  
  258.  
  259. echo checking for minix/config.h
  260. cat > conftest.c <<EOF
  261. #include <minix/config.h>
  262. EOF
  263. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  264. if test -z "$err"; then
  265.   MINIX=1
  266. fi
  267. rm -f conftest*
  268.  
  269. # The Minix shell can't assign to the same variable on the same line!
  270. if test -n "$MINIX"; then
  271.   {
  272. test -n "$verbose" && \
  273. echo '    defining' _POSIX_SOURCE
  274. DEFS="$DEFS -D_POSIX_SOURCE=1"
  275. }
  276.  
  277.   {
  278. test -n "$verbose" && \
  279. echo '    defining' _POSIX_1_SOURCE to be '2'
  280. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  281. }
  282.  
  283.   {
  284. test -n "$verbose" && \
  285. echo '    defining' _MINIX
  286. DEFS="$DEFS -D_MINIX=1"
  287. }
  288.  
  289. fi
  290.  
  291. echo checking for POSIXized ISC
  292. if test -d /etc/conf/kconfig.d &&
  293.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  294. then
  295.   ISC=1 # If later tests want to check for ISC.
  296.   {
  297. test -n "$verbose" && \
  298. echo '    defining' _POSIX_SOURCE
  299. DEFS="$DEFS -D_POSIX_SOURCE=1"
  300. }
  301.  
  302.   if test -n "$GCC"; then
  303.     CC="$CC -posix"
  304.   else
  305.     CC="$CC -Xp"
  306.   fi
  307. fi
  308.  
  309. echo checking for return type of signal handlers
  310. cat > conftest.c <<EOF
  311. #include <sys/types.h>
  312. #include <signal.h>
  313. #ifdef signal
  314. #undef signal
  315. #endif
  316. extern void (*signal ()) ();
  317. int main() { exit(0); }
  318. int t() { int i; }
  319. EOF
  320. if eval $compile; then
  321.   {
  322. test -n "$verbose" && \
  323. echo '    defining' RETSIGTYPE to be 'void'
  324. DEFS="$DEFS -DRETSIGTYPE=void"
  325. }
  326.  
  327. else
  328.   {
  329. test -n "$verbose" && \
  330. echo '    defining' RETSIGTYPE to be 'int'
  331. DEFS="$DEFS -DRETSIGTYPE=int"
  332. }
  333.  
  334. fi
  335. rm -f conftest*
  336.  
  337.  
  338. echo checking for major, minor and makedev header
  339. cat > conftest.c <<EOF
  340. #include <sys/types.h>
  341. int main() { exit(0); }
  342. int t() { return makedev(0, 0); }
  343. EOF
  344. if eval $compile; then
  345.   makedev=1
  346. fi
  347. rm -f conftest*
  348.  
  349. if test -z "$makedev"; then
  350. echo checking for sys/mkdev.h
  351. cat > conftest.c <<EOF
  352. #include <sys/mkdev.h>
  353. EOF
  354. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  355. if test -z "$err"; then
  356.   {
  357. test -n "$verbose" && \
  358. echo '    defining' MAJOR_IN_MKDEV
  359. DEFS="$DEFS -DMAJOR_IN_MKDEV=1"
  360. }
  361.  makedev=1
  362. fi
  363. rm -f conftest*
  364.  
  365. fi
  366. if test -z "$makedev"; then
  367. echo checking for sys/sysmacros.h
  368. cat > conftest.c <<EOF
  369. #include <sys/sysmacros.h>
  370. EOF
  371. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  372. if test -z "$err"; then
  373.   {
  374. test -n "$verbose" && \
  375. echo '    defining' MAJOR_IN_SYSMACROS
  376. DEFS="$DEFS -DMAJOR_IN_SYSMACROS=1"
  377. }
  378.  
  379. fi
  380. rm -f conftest*
  381.  
  382. fi
  383.  
  384. echo checking for remote tape and socket header files
  385. echo checking for sys/mtio.h
  386. cat > conftest.c <<EOF
  387. #include <sys/mtio.h>
  388. EOF
  389. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  390. if test -z "$err"; then
  391.   {
  392. test -n "$verbose" && \
  393. echo '    defining' HAVE_SYS_MTIO_H
  394. DEFS="$DEFS -DHAVE_SYS_MTIO_H=1"
  395. }
  396.  have_mtio=1
  397. fi
  398. rm -f conftest*
  399.  
  400. if test -n "$have_mtio"; then
  401. cat > conftest.c <<EOF
  402. #include <sgtty.h>
  403. #include <sys/socket.h>
  404. EOF
  405. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  406. if test -z "$err"; then
  407.   PROGS="$PROGS rmt"
  408. fi
  409. rm -f conftest*
  410. fi
  411.  
  412. test -n "$have_mtio" && PROGS="$PROGS mt"
  413. echo checking for remote shell
  414. if test -f /usr/ucb/rsh || test -f /usr/bin/remsh || test -f /usr/bin/rsh ||
  415.   test -f /usr/bsd/rsh || test -f /usr/bin/nsh; then
  416.   RTAPELIB=rtapelib.o
  417. else
  418.   echo checking for netdb.h
  419. cat > conftest.c <<EOF
  420. #include <netdb.h>
  421. EOF
  422. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  423. if test -z "$err"; then
  424.   {
  425. test -n "$verbose" && \
  426. echo '    defining' HAVE_NETDB_H
  427. DEFS="$DEFS -DHAVE_NETDB_H=1"
  428. }
  429.  RTAPELIB=rtapelib.o
  430. else
  431.   {
  432. test -n "$verbose" && \
  433. echo '    defining' NO_REMOTE
  434. DEFS="$DEFS -DNO_REMOTE=1"
  435. }
  436.  
  437. fi
  438. rm -f conftest*
  439.  
  440. fi
  441.  
  442. prog='/* Ultrix mips cc rejects this.  */
  443. typedef int charset[2]; const charset x;
  444. /* SunOS 4.1.1 cc rejects this.  */
  445. char const *const *ccp;
  446. char **p;
  447. /* AIX XL C 1.02.0.0 rejects this.
  448.    It does not let you subtract one const X* pointer from another in an arm
  449.    of an if-expression whose if-part is not a constant expression */
  450. const char *g = "string";
  451. p = &g + (g ? g-g : 0);
  452. /* HPUX 7.0 cc rejects these. */
  453. ++ccp;
  454. p = (char**) ccp;
  455. ccp = (char const *const *) p;
  456. { /* SCO 3.2v4 cc rejects this.  */
  457.   char *t;
  458.   char const *s = 0 ? (char *) 0 : (char const *) 0;
  459.  
  460.   *t++ = 0;
  461. }
  462. { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
  463.   int x[] = {25,17};
  464.   const int *foo = &x[0];
  465.   ++foo;
  466. }
  467. { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
  468.   typedef const int *iptr;
  469.   iptr p = 0;
  470.   ++p;
  471. }
  472. { /* AIX XL C 1.02.0.0 rejects this saying
  473.      "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
  474.   struct s { int j; const int *ap[3]; };
  475.   struct s *b; b->j = 5;
  476. }'
  477. echo checking for working const
  478. cat > conftest.c <<EOF
  479.  
  480. int main() { exit(0); }
  481. int t() { $prog }
  482. EOF
  483. if eval $compile; then
  484.   :
  485. else
  486.   {
  487. test -n "$verbose" && \
  488. echo '    defining' const to be 'empty'
  489. DEFS="$DEFS -Dconst="
  490. }
  491.  
  492. fi
  493. rm -f conftest*
  494.  
  495. echo checking for uid_t in sys/types.h
  496. echo '#include <sys/types.h>' > conftest.c
  497. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  498. if egrep "uid_t" conftest.out >/dev/null 2>&1; then
  499.   :
  500. else
  501.   {
  502. test -n "$verbose" && \
  503. echo '    defining' uid_t to be 'int'
  504. DEFS="$DEFS -Duid_t=int"
  505. }
  506.  {
  507. test -n "$verbose" && \
  508. echo '    defining' gid_t to be 'int'
  509. DEFS="$DEFS -Dgid_t=int"
  510. }
  511.  
  512. fi
  513. rm -f conftest*
  514.  
  515. echo checking for ANSI C header files
  516. cat > conftest.c <<EOF
  517. #include <stdlib.h>
  518. #include <stdarg.h>
  519. #include <string.h>
  520. #include <float.h>
  521. EOF
  522. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  523. if test -z "$err"; then
  524.   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  525. echo '#include <string.h>' > conftest.c
  526. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  527. if egrep "memchr" conftest.out >/dev/null 2>&1; then
  528.   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  529. cat > conftest.c <<EOF
  530. #include <ctype.h>
  531. #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
  532. #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
  533. #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
  534. int main () { int i; for (i = 0; i < 256; i++)
  535. if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
  536. exit (0); }
  537.  
  538. EOF
  539. eval $compile
  540. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  541.   {
  542. test -n "$verbose" && \
  543. echo '    defining' STDC_HEADERS
  544. DEFS="$DEFS -DSTDC_HEADERS=1"
  545. }
  546.  
  547. fi
  548. rm -f conftest*
  549. fi
  550. rm -f conftest*
  551.  
  552. fi
  553. rm -f conftest*
  554.  
  555. echo checking for unistd.h
  556. cat > conftest.c <<EOF
  557. #include <unistd.h>
  558. EOF
  559. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  560. if test -z "$err"; then
  561.   {
  562. test -n "$verbose" && \
  563. echo '    defining' HAVE_UNISTD_H
  564. DEFS="$DEFS -DHAVE_UNISTD_H=1"
  565. }
  566.  
  567. fi
  568. rm -f conftest*
  569.  
  570. for hdr in string.h fcntl.h utime.h sys/io/trioctl.h
  571. do
  572. trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
  573. echo checking for ${hdr}
  574. cat > conftest.c <<EOF
  575. #include <${hdr}>
  576. EOF
  577. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  578. if test -z "$err"; then
  579.   {
  580. test -n "$verbose" && \
  581. echo '    defining' ${trhdr}
  582. DEFS="$DEFS -D${trhdr}=1"
  583. }
  584.  
  585. fi
  586. rm -f conftest*
  587. done
  588.  
  589. for func in fnmatch bcopy mkdir strdup
  590. do
  591. echo checking for ${func}
  592. cat > conftest.c <<EOF
  593.  
  594. int main() { exit(0); }
  595. int t() { /* The GNU C library defines this for functions which it implements
  596.     to always fail with ENOSYS.  Some functions are actually named
  597.     something starting with __ and the normal name is an alias.  */
  598. #if defined (__stub_${func}) || defined (__stub___${func})
  599. choke me
  600. #else
  601. /* Override any gcc2 internal prototype to avoid an error.  */
  602. extern char ${func}(); ${func}();
  603. #endif
  604.  }
  605. EOF
  606. if eval $compile; then
  607.   :
  608. else
  609.   LIBOBJS="$LIBOBJS ${func}.o"
  610. test -n "$verbose" && echo "    using ${func}.o instead"
  611. fi
  612. rm -f conftest*
  613.  
  614. done
  615.  
  616. for func in strerror lchown
  617. do
  618. trfunc=HAVE_`echo $func | tr '[a-z]' '[A-Z]'`
  619. echo checking for ${func}
  620. cat > conftest.c <<EOF
  621. #include <ctype.h>
  622. int main() { exit(0); }
  623. int t() { 
  624. /* The GNU C library defines this for functions which it implements
  625.     to always fail with ENOSYS.  Some functions are actually named
  626.     something starting with __ and the normal name is an alias.  */
  627. #if defined (__stub_${func}) || defined (__stub___${func})
  628. choke me
  629. #else
  630. /* Override any gcc2 internal prototype to avoid an error.  */
  631. extern char ${func}(); ${func}();
  632. #endif
  633.  }
  634. EOF
  635. if eval $compile; then
  636.   {
  637. test -n "$verbose" && \
  638. echo '    defining' ${trfunc}
  639. DEFS="$DEFS -D${trfunc}=1"
  640. }
  641.  
  642. fi
  643. rm -f conftest*
  644. done
  645.  
  646. echo checking for vprintf
  647. cat > conftest.c <<EOF
  648.  
  649. int main() { exit(0); }
  650. int t() { vprintf(); }
  651. EOF
  652. if eval $compile; then
  653.   {
  654. test -n "$verbose" && \
  655. echo '    defining' HAVE_VPRINTF
  656. DEFS="$DEFS -DHAVE_VPRINTF=1"
  657. }
  658.  
  659. else
  660.   vprintf_missing=1
  661. fi
  662. rm -f conftest*
  663.  
  664. if test -n "$vprintf_missing"; then
  665. echo checking for _doprnt
  666. cat > conftest.c <<EOF
  667.  
  668. int main() { exit(0); }
  669. int t() { _doprnt(); }
  670. EOF
  671. if eval $compile; then
  672.   {
  673. test -n "$verbose" && \
  674. echo '    defining' HAVE_DOPRNT
  675. DEFS="$DEFS -DHAVE_DOPRNT=1"
  676. }
  677.  
  678. fi
  679. rm -f conftest*
  680.  
  681. fi
  682.  
  683. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  684. # for constant arguments.  Useless!
  685. echo checking for working alloca.h
  686. cat > conftest.c <<EOF
  687. #include <alloca.h>
  688. int main() { exit(0); }
  689. int t() { char *p = alloca(2 * sizeof(int)); }
  690. EOF
  691. if eval $compile; then
  692.   {
  693. test -n "$verbose" && \
  694. echo '    defining' HAVE_ALLOCA_H
  695. DEFS="$DEFS -DHAVE_ALLOCA_H=1"
  696. }
  697.  
  698. fi
  699. rm -f conftest*
  700.  
  701. decl="#ifdef __GNUC__
  702. #define alloca __builtin_alloca
  703. #else
  704. #if HAVE_ALLOCA_H
  705. #include <alloca.h>
  706. #else
  707. #ifdef _AIX
  708.  #pragma alloca
  709. #else
  710. char *alloca ();
  711. #endif
  712. #endif
  713. #endif
  714. "
  715. echo checking for alloca
  716. cat > conftest.c <<EOF
  717. $decl
  718. int main() { exit(0); }
  719. int t() { char *p = (char *) alloca(1); }
  720. EOF
  721. if eval $compile; then
  722.   :
  723. else
  724.   alloca_missing=1
  725. cat > conftest.c <<EOF
  726.  
  727. #if defined(CRAY) && ! defined(CRAY2)
  728. winnitude
  729. #else
  730. lossage
  731. #endif
  732.  
  733. EOF
  734. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  735. if egrep "winnitude" conftest.out >/dev/null 2>&1; then
  736.   echo checking for _getb67
  737. cat > conftest.c <<EOF
  738. #include <ctype.h>
  739. int main() { exit(0); }
  740. int t() { 
  741. /* The GNU C library defines this for functions which it implements
  742.     to always fail with ENOSYS.  Some functions are actually named
  743.     something starting with __ and the normal name is an alias.  */
  744. #if defined (__stub__getb67) || defined (__stub____getb67)
  745. choke me
  746. #else
  747. /* Override any gcc2 internal prototype to avoid an error.  */
  748. extern char _getb67(); _getb67();
  749. #endif
  750.  }
  751. EOF
  752. if eval $compile; then
  753.   {
  754. test -n "$verbose" && \
  755. echo '    defining' CRAY_STACKSEG_END to be '_getb67'
  756. DEFS="$DEFS -DCRAY_STACKSEG_END=_getb67"
  757. }
  758.  
  759. else
  760.   echo checking for GETB67
  761. cat > conftest.c <<EOF
  762. #include <ctype.h>
  763. int main() { exit(0); }
  764. int t() { 
  765. /* The GNU C library defines this for functions which it implements
  766.     to always fail with ENOSYS.  Some functions are actually named
  767.     something starting with __ and the normal name is an alias.  */
  768. #if defined (__stub_GETB67) || defined (__stub___GETB67)
  769. choke me
  770. #else
  771. /* Override any gcc2 internal prototype to avoid an error.  */
  772. extern char GETB67(); GETB67();
  773. #endif
  774.  }
  775. EOF
  776. if eval $compile; then
  777.   {
  778. test -n "$verbose" && \
  779. echo '    defining' CRAY_STACKSEG_END to be 'GETB67'
  780. DEFS="$DEFS -DCRAY_STACKSEG_END=GETB67"
  781. }
  782.  
  783. else
  784.   echo checking for getb67
  785. cat > conftest.c <<EOF
  786. #include <ctype.h>
  787. int main() { exit(0); }
  788. int t() { 
  789. /* The GNU C library defines this for functions which it implements
  790.     to always fail with ENOSYS.  Some functions are actually named
  791.     something starting with __ and the normal name is an alias.  */
  792. #if defined (__stub_getb67) || defined (__stub___getb67)
  793. choke me
  794. #else
  795. /* Override any gcc2 internal prototype to avoid an error.  */
  796. extern char getb67(); getb67();
  797. #endif
  798.  }
  799. EOF
  800. if eval $compile; then
  801.   {
  802. test -n "$verbose" && \
  803. echo '    defining' CRAY_STACKSEG_END to be 'getb67'
  804. DEFS="$DEFS -DCRAY_STACKSEG_END=getb67"
  805. }
  806.  
  807. fi
  808. rm -f conftest*
  809.  
  810. fi
  811. rm -f conftest*
  812.  
  813. fi
  814. rm -f conftest*
  815.  
  816. fi
  817. rm -f conftest*
  818.  
  819.  
  820. fi
  821. rm -f conftest*
  822.  
  823. if test -n "$alloca_missing"; then
  824.   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
  825.   # that cause trouble.  Some versions do not even contain alloca or
  826.   # contain a buggy version.  If you still want to use their alloca,
  827.   # use ar to extract alloca.o from them instead of compiling alloca.c.
  828.   ALLOCA=alloca.o
  829.  
  830.   echo 'checking stack direction for C alloca'
  831.   echo checking whether cross-compiling
  832. # If we cannot run a trivial program, we must be cross compiling.
  833. cat > conftest.c <<EOF
  834. main(){exit(0);}
  835. EOF
  836. eval $compile
  837. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  838.   :
  839. else
  840.   cross_compiling=1
  841. fi
  842. rm -f conftest*
  843.  
  844. if test -n "$cross_compiling"
  845. then
  846.   {
  847. test -n "$verbose" && \
  848. echo '    defining' STACK_DIRECTION to be '0'
  849. DEFS="$DEFS -DSTACK_DIRECTION=0"
  850. }
  851.  
  852. else
  853. cat > conftest.c <<EOF
  854. find_stack_direction ()
  855. {
  856.   static char *addr = 0;
  857.   auto char dummy;
  858.   if (addr == 0)
  859.     {
  860.       addr = &dummy;
  861.       return find_stack_direction ();
  862.     }
  863.   else
  864.     return (&dummy > addr) ? 1 : -1;
  865. }
  866. main ()
  867. {
  868.   exit (find_stack_direction() < 0);
  869. }
  870. EOF
  871. eval $compile
  872. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  873.   {
  874. test -n "$verbose" && \
  875. echo '    defining' STACK_DIRECTION to be '1'
  876. DEFS="$DEFS -DSTACK_DIRECTION=1"
  877. }
  878.  
  879. else
  880.   {
  881. test -n "$verbose" && \
  882. echo '    defining' STACK_DIRECTION to be '-1'
  883. DEFS="$DEFS -DSTACK_DIRECTION=-1"
  884. }
  885.  
  886. fi
  887. fi
  888. rm -f conftest*
  889. fi
  890.  
  891. echo checking for directory library header
  892. dirheader=
  893. if test -z "$dirheader"; then
  894.   echo checking for dirent.h
  895. cat > conftest.c <<EOF
  896. #include <sys/types.h>
  897. #include <dirent.h>
  898. int main() { exit(0); }
  899. int t() { DIR *dirp = opendir ("/"); }
  900. EOF
  901. if eval $compile; then
  902.   {
  903. test -n "$verbose" && \
  904. echo '    defining' DIRENT
  905. DEFS="$DEFS -DDIRENT=1"
  906. }
  907.  dirheader=dirent.h
  908. fi
  909. rm -f conftest*
  910. fi
  911. if test -z "$dirheader"; then
  912.   echo checking for sys/ndir.h
  913. cat > conftest.c <<EOF
  914. #include <sys/types.h>
  915. #include <sys/ndir.h>
  916. int main() { exit(0); }
  917. int t() { DIR *dirp = opendir ("/"); }
  918. EOF
  919. if eval $compile; then
  920.   {
  921. test -n "$verbose" && \
  922. echo '    defining' SYSNDIR
  923. DEFS="$DEFS -DSYSNDIR=1"
  924. }
  925.  dirheader=sys/ndir.h
  926. fi
  927. rm -f conftest*
  928. fi
  929. if test -z "$dirheader"; then
  930.   echo checking for sys/dir.h
  931. cat > conftest.c <<EOF
  932. #include <sys/types.h>
  933. #include <sys/dir.h>
  934. int main() { exit(0); }
  935. int t() { DIR *dirp = opendir ("/"); }
  936. EOF
  937. if eval $compile; then
  938.   {
  939. test -n "$verbose" && \
  940. echo '    defining' SYSDIR
  941. DEFS="$DEFS -DSYSDIR=1"
  942. }
  943.  dirheader=sys/dir.h
  944. fi
  945. rm -f conftest*
  946. fi
  947. if test -z "$dirheader"; then
  948.   echo checking for ndir.h
  949. cat > conftest.c <<EOF
  950. #include <sys/types.h>
  951. #include <ndir.h>
  952. int main() { exit(0); }
  953. int t() { DIR *dirp = opendir ("/"); }
  954. EOF
  955. if eval $compile; then
  956.   {
  957. test -n "$verbose" && \
  958. echo '    defining' NDIR
  959. DEFS="$DEFS -DNDIR=1"
  960. }
  961.  dirheader=ndir.h
  962. fi
  963. rm -f conftest*
  964. fi
  965.  
  966. echo checking for closedir return value
  967. cat > conftest.c <<EOF
  968. #include <sys/types.h>
  969. #include <$dirheader>
  970. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  971. EOF
  972. eval $compile
  973. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  974.   :
  975. else
  976.   {
  977. test -n "$verbose" && \
  978. echo '    defining' VOID_CLOSEDIR
  979. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  980. }
  981.  
  982. fi
  983. rm -f conftest*
  984.  
  985. echo checking for Xenix
  986. cat > conftest.c <<EOF
  987. #if defined(M_XENIX) && !defined(M_UNIX)
  988.   yes
  989. #endif
  990.  
  991. EOF
  992. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  993. if egrep "yes" conftest.out >/dev/null 2>&1; then
  994.   XENIX=1
  995. fi
  996. rm -f conftest*
  997.  
  998. if test -n "$XENIX"; then
  999.   LIBS="$LIBS -lx"
  1000.   case "$DEFS" in
  1001.   *SYSNDIR*) ;;
  1002.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  1003.   esac
  1004. fi
  1005.  
  1006. LIBS_save="${LIBS}"
  1007. LIBS="${LIBS} -lsocket"
  1008. have_lib=""
  1009. echo checking for -lsocket
  1010. cat > conftest.c <<EOF
  1011.  
  1012. int main() { exit(0); }
  1013. int t() { main(); }
  1014. EOF
  1015. if eval $compile; then
  1016.   have_lib="1"
  1017. fi
  1018. rm -f conftest*
  1019. LIBS="${LIBS_save}"
  1020. if test -n "${have_lib}"; then
  1021.    :; LIBS="$LIBS -lsocket"
  1022. else
  1023.    :; 
  1024. fi
  1025.  
  1026. LIBS_save="${LIBS}"
  1027. LIBS="${LIBS} -lnsl"
  1028. have_lib=""
  1029. echo checking for -lnsl
  1030. cat > conftest.c <<EOF
  1031.  
  1032. int main() { exit(0); }
  1033. int t() { main(); }
  1034. EOF
  1035. if eval $compile; then
  1036.   have_lib="1"
  1037. fi
  1038. rm -f conftest*
  1039. LIBS="${LIBS_save}"
  1040. if test -n "${have_lib}"; then
  1041.    :; LIBS="$LIBS -lnsl"
  1042. else
  1043.    :; 
  1044. fi
  1045.  
  1046. if test -n "$prefix"; then
  1047.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  1048.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  1049. fi
  1050. if test -n "$exec_prefix"; then
  1051.   prsub="$prsub
  1052. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  1053. fi
  1054. cat >conftest.def <<EOF
  1055. $DEFS
  1056. EOF
  1057. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  1058. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  1059. rm -f conftest.def
  1060.  
  1061. trap 'rm -f config.status; exit 1' 1 3 15
  1062. echo creating config.status
  1063. rm -f config.status
  1064. cat > config.status <<EOF
  1065. #!/bin/sh
  1066. # Generated automatically by configure.
  1067. # Run this file to recreate the current configuration.
  1068. # This directory was configured as follows,
  1069. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  1070. #
  1071. # $0 $configure_args
  1072.  
  1073. for arg
  1074. do
  1075.   case "\$arg" in
  1076.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  1077.     exec /bin/sh $0 $configure_args ;;
  1078.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  1079.   esac
  1080. done
  1081.  
  1082. trap 'rm -f Makefile; exit 1' 1 3 15
  1083. PROGS='$PROGS'
  1084. CC='$CC'
  1085. CPP='$CPP'
  1086. INSTALL='$INSTALL'
  1087. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  1088. INSTALL_DATA='$INSTALL_DATA'
  1089. RTAPELIB='$RTAPELIB'
  1090. LIBOBJS='$LIBOBJS'
  1091. ALLOCA='$ALLOCA'
  1092. LIBS='$LIBS'
  1093. srcdir='$srcdir'
  1094. DEFS='$DEFS'
  1095. prefix='$prefix'
  1096. exec_prefix='$exec_prefix'
  1097. prsub='$prsub'
  1098. EOF
  1099. cat >> config.status <<\EOF
  1100.  
  1101. top_srcdir=$srcdir
  1102.  
  1103. # Allow make-time overrides of the generated file list.
  1104. test -n "$gen_files" || gen_files="Makefile"
  1105.  
  1106. for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
  1107.   srcdir=$top_srcdir
  1108.   # Remove last slash and all that follows it.  Not all systems have dirname.
  1109.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  1110.   if test "$dir" != "$file"; then
  1111.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  1112.     test ! -d $dir && mkdir $dir
  1113.   fi
  1114.   echo creating $file
  1115.   rm -f $file
  1116.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  1117.   sed -e "
  1118. $prsub
  1119. s%@PROGS@%$PROGS%g
  1120. s%@CC@%$CC%g
  1121. s%@CPP@%$CPP%g
  1122. s%@INSTALL@%$INSTALL%g
  1123. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  1124. s%@INSTALL_DATA@%$INSTALL_DATA%g
  1125. s%@RTAPELIB@%$RTAPELIB%g
  1126. s%@LIBOBJS@%$LIBOBJS%g
  1127. s%@ALLOCA@%$ALLOCA%g
  1128. s%@LIBS@%$LIBS%g
  1129. s%@srcdir@%$srcdir%g
  1130. s%@DEFS@%$DEFS%
  1131. " $top_srcdir/${file}.in >> $file
  1132. fi; done
  1133.  
  1134. exit 0
  1135. EOF
  1136. chmod +x config.status
  1137. test -n "$no_create" || ./config.status
  1138.  
  1139.